<?php namespace Phpcmf\Controllers;

class Home extends \Phpcmf\Common
{

    public function index() {

        $pre = \Phpcmf\Service::M()->dbprefix(SITE_ID.'_');
        $sql = 'select c.*,b.stime,b.etime,b.type as ptype,b.title as pname from `'.$pre.'goods_promotion_item` as `a` left join `'.$pre.'goods_promotion` as `b` on a.pid=b.id left join `'.$pre.'goods` as `c` on a.cid=c.id where b.status=1 and c.is_sale=1 and (b.stime < '.SYS_TIME.' and b.etime > '.SYS_TIME.') order by c.updatetime';

        \Phpcmf\Service::V()->assign([
            'catid' => '1',
            'markid' => 'new-goods',
            'urlrule' => '/index.php?s=goods&page=[page]',
            'query_sql' => urlencode($sql),
            'meta_title' => $this->mall_info['promotion_page'][SITE_ID]['title'],
            'meta_keywords' => $this->mall_info['promotion_page'][SITE_ID]['keywords'],
            'meta_description' => $this->mall_info['promotion_page'][SITE_ID]['description'],
        ]);
        \Phpcmf\Service::V()->display('goods.html');
    }

}
